package com.example.chasshelper;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.Button;

import com.example.chasshelper.dao.ClassroomDao;
import com.example.chasshelper.dao.CourseDao;
import com.example.chasshelper.dao.MessageDao;
import com.example.chasshelper.dao.RegistrationDao;
import com.example.chasshelper.dao.SolutionDao;
import com.example.chasshelper.dao.StudentDao;
import com.example.chasshelper.dao.TeacherDao;
import com.example.chasshelper.dao.TestDao;
import com.example.chasshelper.model.Course;
import com.example.chasshelper.model.Student;
import com.example.chasshelper.model.Teacher;
import com.example.chasshelper.utils.DaoUtils;

public class SubjectStuActivity extends AppCompatActivity implements View.OnClickListener {
    private static final String TAG = SubjectStuActivity.class.getSimpleName();
    private final Activity mContext = SubjectStuActivity.this;
    //控件
    private Button btn_back;
    //dao
    private TeacherDao teacherDao= DaoUtils.getTeacherDao();
    private StudentDao studentDao=DaoUtils.getStudentDao();
    private CourseDao courseDao=DaoUtils.getCourseDao();
    private ClassroomDao classroomDao=DaoUtils.getClassroomDao();
    private RegistrationDao registrationDao=DaoUtils.getRegistrationDao();
    private SolutionDao solutionDao = DaoUtils.getSolutionDao();
    private MessageDao messageDao = DaoUtils.getMessageDao();
    private TestDao testDao = DaoUtils.getTestDao();
    //数据
    private Student student;
    private Course course;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_subject_stu);
        //线程
        if (android.os.Build.VERSION.SDK_INT > 9) {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);
        }
        //初始化界面
        initUI();
        //初始化数据
        initData();

    }
    private void initUI() {
        //绑定控件
        btn_back = findViewById(R.id.btn_back);
        //点击事件
        btn_back.setOnClickListener(this);
    }

    private void initData() {
        student = (Student) getIntent().getSerializableExtra("student");
        course = (Course) getIntent().getSerializableExtra("course");
        //adapter实例化：无
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_back://登录，前往主页面,并传递数据
                finish();
                break;
        }
    }

}